import { FC } from "react";
import { questionParagraph_propsType } from "./index";
import { Form, Input, Checkbox } from "antd";
const { TextArea } = Input;
const PropsComponent: FC<questionParagraph_propsType> = (props) => {
  const { text, iscenter, islock = false,onchange} = props;
  const [form] = Form.useForm();
  const valuechange = () => {
    if(onchange){
        onchange(form.getFieldsValue());
    }
  };
  return (
    <Form disabled = {islock} layout="vertical" form={form} onValuesChange={valuechange} initialValues={{text, iscenter}}>
      <Form.Item name="text" label="输入框" >
        <TextArea value={text}></TextArea>
      </Form.Item>
      <Form.Item label="是否居中" name="iscenter" valuePropName="checked">
        <Checkbox></Checkbox>
      </Form.Item>
    </Form>
  );
};

export default PropsComponent;
